package wyklad;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.Date;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class PowolnySerwlet extends javax.servlet.http.HttpServlet implements javax.servlet.Servlet {
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		doPost(request, response);
	}

	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		synchronized (this) {
			try {
				Thread.currentThread().sleep(5000);
			} catch (InterruptedException e) {
				System.err.println("Przerwany");
			}
		}
		response.setContentType("text/html;charset=utf8");
		PrintWriter pw = response.getWriter();
		pw.println("<html>");
		pw.println("<head>");
		pw.println("</head>");
		pw.println("<body>");
		pw.println("<h3>PowolnySerwlet</h3>");
		pw.println(new Date());
		pw.println("</body>");
		pw.println("</html>");
		pw.close();
	}
}